package jsu.xxy.coffee3.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jsu.xxy.coffee3.domain.Ordered;
import jsu.xxy.coffee3.domain.Orderform;
import net.sf.jsqlparser.expression.DateTimeLiteralExpression;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

/**
* @author 张从轩
* @description 针对表【orderform(订单表)】的数据库操作Mapper
* @createDate 2023-06-03 06:27:54
* @Entity jsu.xxy.coffee3.domain.Orderform
*/
@Mapper
public interface OrderformMapper extends BaseMapper<Orderform> {

//获得所有order编号及其他信息
    public List<Ordered> getOrdered(Integer pageNo, Integer pageSize);

//    "通过订单id查找完成的订单")
    List<Ordered> getAOrdered(int oid);
//未完成订单数量
    public long getAllSize();


//完成订单
    long getAllSizeEd();

    @Select("select * from orderform where cid = #{cid}")
    List<Ordered> getOrderByCid(int cid);

    @Insert("insert into orderform (statu ,cid, time , total,remarks,totalnum) values (#{statu} ,#{cid}, #{time} , #{total},#{remarks},#{totalnum})")
    int add(Integer statu,Integer cid, String time, Double total, String remarks, Integer totalnum);

    @Select("select oid from orderform where time = #{time}")
    int getOidByTime(String time);

    public List<Ordered> getOrdering(int pageNo,int pageSize);

    public  int changeStatue(int oid);
}
